import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'
import curriculum from '../components/main/curriculum'
import order from '../components/main/order'
import returnBack from "@/components/main/returnBack";
import news from "@/components/main/news";
import user from "@/components/main/user";
import Info from "@/components/personalInfo/Info";
import address from "@/components/personalInfo/address";
import account from "@/components/personalInfo/account";

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    children: [
      {
        path: '/',
        name: 'curriculum',
        component: curriculum,
        alias: '/curriculum',
      },
      {
        path: '/order',
        name: 'order',
        component: order,
      },
      {
        path: '/return',
        name: 'return',
        component: returnBack,
      },
      {
        path: '/news',
        name: 'news',
        component: news,
      },
      {
        path: '/user',
        name: 'user',
        component: user,
        children: [
          {
            path: '/user/info',
            name: 'info',
            component: Info,
            alias: '/user',
          },
          {
            path: '/user/address',
            name: 'address',
            component: address,
          },
          {
            path: '/user/account',
            name: 'account',
            component: account,
          },
        ]
      }
    ]
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
